Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[move-vm] Types and opcodes for closures #15171

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[move-vm] Types and opcodes for closures #15171

wants to merge 1 commit into from

Conversation

wrwg
Copy link
Contributor

@wrwg wrwg commented Nov 3, 2024

Description

This PR implements the extensions needed in the file format for representing closures:

  • The type (SignatureToken) has a new variant Function(args, result, abilities) to represent a function type
  • The opcodes are extendeed by operations ClosPack, ClosPackGeneric, and ClosEval

This supports bit masks for specifyinng which arguments of a function are captured when creating a closure.

Bytecode verification is extended to support the new types and opcodes. The implementation of consistency, type, and reference safety should be complete. What is missing are:

  • File format serialization
  • Interpreter and value representation
  • Value serialization
  • Connection of the new types with the various other type representations

This also removes the obsolete crate testing-infra/test-generation. This crate already did not support many older bytecode extensions, e.g. vector ops, and is nowhere used.

How Has This Been Tested?

No tests yet

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

This PR implements the extensions needed in the file format for representing closures:

- The type (SignatureToken) has a new variant `Function(args, result, abilities)` to represent a function type
- The opcodes are extendeed by operations `ClosPack`, `ClosPackGeneric`, and `ClosEval`

This supports bit masks for specifyinng which arguments of a function are captured when creating a closure.

Bytecode verification is extended to support the new types and opcodes. The implementation of consistency, type, and reference safety should be complete. What is missing are:

- File format serialization
- Interpreter and value representation
- Value serialization
- Connection of the new types with the various other type representations
Copy link

trunk-io bot commented Nov 3, 2024

⏱️ 13m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 9m 🟩
rust-cargo-deny 2m 🟩
check-dynamic-deps 36s 🟩
general-lints 27s 🟩
semgrep/ci 25s 🟩
file_change_determinator 11s 🟩
permission-check 3s 🟩
permission-check 3s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

wrwg commented Nov 3, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @wrwg and the rest of your teammates on Graphite Graphite

@georgemitenkov
Copy link
Contributor

@wrwg it is probably better to factor testing-infra/test-generation removal into separate PR. This way it is easy to find (if we want it back for any reason), and the diff gets smaller

@brmataptos
Copy link
Contributor

@wrwg it is probably better to factor testing-infra/test-generation removal into separate PR. This way it is easy to find (if we want it back for any reason), and the diff gets smaller

That has been submitted as #15354.

The rest of this PR is cherry-picked as the first commit of #15387.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants